package com.xtaller.lazy.config.aop;

import cn.yueshutong.springbootstartercurrentlimiting.annotation.CurrentLimiter;
import cn.yueshutong.springbootstartercurrentlimiting.handler.CurrentAspectHandler;
import com.xtaller.lazy.lib.R;
import com.xtaller.lazy.lib.convert.J;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

/**
 * @version V1.0
 * @author: Taller
 * @date: 2019-04-23
 * @Description: 方法限流策略
 */
@Component
public class LimiterFunAspect implements CurrentAspectHandler {
    @Override
    public Object around(ProceedingJoinPoint pjp, CurrentLimiter rateLimiter) throws Throwable {
        return R.error(HttpStatus.TOO_MANY_REQUESTS, "当前服务器限流 code:1000");
    }
}
